UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9rReVctGTwyedKieqNNLmQZKLZKeQk4+8QDS/PjjRO4='
WHERE
key_id = '31590330f6e27ef3dc8cfa15308c624204fe52dd4100acf666964bdca5c93bd8'
AND (
token = '9rReVctGTwyedKieqNNLmQZKLZKeQk4+8QDS/PjjRO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)