UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gpRhkl2UNjY903Ye/5emul6JWEf3Duy3BIHn7bIdGV0='
WHERE
key_id = 'ce1ab54302c18ee0ef18b9d84d5efbb56709db9c2207cf80097f7dab4001e99f'
AND (
token = 'gpRhkl2UNjY903Ye/5emul6JWEf3Duy3BIHn7bIdGV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)