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