UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cPYEUrpJFN/B1/xg/QY5/XAnGWEYw5eWlHsywohs0dc='
WHERE
key_id = 'a3760dc381266bbaa7686fe23821e168baf9b171e8f9544289e3aab268821ab9'
AND (
token = 'cPYEUrpJFN/B1/xg/QY5/XAnGWEYw5eWlHsywohs0dc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)