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