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