UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cnKDTfoRNQs7KUFK8IESXgqlhorgUBpqbQF22yT5ys4='
WHERE
key_id = 'cfe10db044c481dd878997b9d6bce034d05df5c5a7a03e86b0e9a2949f4c3953'
AND (
token = 'cnKDTfoRNQs7KUFK8IESXgqlhorgUBpqbQF22yT5ys4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)