UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n1hD7+nFHgguTUH/UoRSFmPGZf2AvqE/XZuC6aynKpw='
WHERE
key_id = '32cf457fbd81e1c204bcb898b1295705a5cc8b1fd30d04a7399c81d08ca6f200'
AND (
token = 'n1hD7+nFHgguTUH/UoRSFmPGZf2AvqE/XZuC6aynKpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)