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