UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6em65QgkDLhh/64pai9DOiv8aw0kT3hpNWuE1lBqhf4='
WHERE
key_id = 'e7dac6bc2987cfde5e33a16075769e07042729b6bbdc95558da3063f04f22dda'
AND (
token = '6em65QgkDLhh/64pai9DOiv8aw0kT3hpNWuE1lBqhf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)