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