UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z7ebYjducDXL36jI13/ZUDBVtWF7nX6i3xDy1ixHKCo='
WHERE
key_id = '40661c02049ba6c9039b35a560b894b2ca383414ef888b0bbda93c49f6706fe1'
AND (
token = 'z7ebYjducDXL36jI13/ZUDBVtWF7nX6i3xDy1ixHKCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)