UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YYTXgjAeLb8ySs3JEM1GZjAZpVYosWfpkZpd4D8zus0='
WHERE
key_id = '9a3fc1dadec8f8aed3ea996da1805ee5ec642e3be67f51b57db6eb3952aba132'
AND (
token = 'YYTXgjAeLb8ySs3JEM1GZjAZpVYosWfpkZpd4D8zus0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)