UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E2qvj5NeOQWg6malsYH+sXa8EaAlIIMpPPJuJdTfol8='
WHERE
key_id = '4f39b94904c0e27bfc69a9e8268437c56bdd00d115982bee002f371e375514ee'
AND (
token = 'E2qvj5NeOQWg6malsYH+sXa8EaAlIIMpPPJuJdTfol8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)