UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fTVjoGwtM5B8N3n4khcbxrClsVKv/+CHC0K0AUaDRIA='
WHERE
key_id = 'af1d6ec8a8303328c132a4f2bd490bf09afa74f79094687a40d5dafbc9234881'
AND (
token = 'fTVjoGwtM5B8N3n4khcbxrClsVKv/+CHC0K0AUaDRIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)