UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gM2A1uYBzhHK5mEQ2XqdkwTeNrs2ZaI9KGMUKpfAsfU='
WHERE
key_id = '8fdb14622595e32b544e7715fefb1b81322aab91de7818ab90b4be1de1b1fdee'
AND (
token = 'gM2A1uYBzhHK5mEQ2XqdkwTeNrs2ZaI9KGMUKpfAsfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)