UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hc0qQKc+TosRsK92C3AOksqSbNs1V8Y39OXlyBZn3RU='
WHERE
key_id = '6c163e49f61a5678572be69fb0430494cb6d3148bb6305a21b9675c64ea8cbef'
AND (
token = 'Hc0qQKc+TosRsK92C3AOksqSbNs1V8Y39OXlyBZn3RU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)