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