UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gu9xxWRa+htKGlb4C33F0nXc551MGl6tuVVjVLEHxUA='
WHERE
key_id = 'a4463740dd5c18873beee7d9e9f0daca55af35163c35090c714c163086503d55'
AND (
token = 'gu9xxWRa+htKGlb4C33F0nXc551MGl6tuVVjVLEHxUA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)