UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TNAi2bCqB4xMT+JmhvO+83kMDkuD7p+kWRdNbWrHeR4='
WHERE
key_id = '5749fe6a346ec454ef7f6f85bd67dbd3c43990dbf729a34f50650a7781ab5637'
AND (
token = 'TNAi2bCqB4xMT+JmhvO+83kMDkuD7p+kWRdNbWrHeR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)