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