UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T/9fNqt5KEEciLjawMnUFDHn8uld7mDkGjG6jZp3Z34='
WHERE
key_id = 'd9220d1fe0c47d0425dbad6d32c34b8417e7ffca26fb9f13ed5d20c80a34e9e3'
AND (
token = 'T/9fNqt5KEEciLjawMnUFDHn8uld7mDkGjG6jZp3Z34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)