UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wqvQ1DVW6tYdI4Y/kVoO3JX+xlrr1Z43CGFUoU9Nq4w='
WHERE
key_id = '9cce64fa9b231b6a5bf8d31eb2b7bca6e92e5627b0bfe18ce67d6eee9d27c39c'
AND (
token = 'wqvQ1DVW6tYdI4Y/kVoO3JX+xlrr1Z43CGFUoU9Nq4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)