UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Do5nQTngt+Yk1hkM4kNqNCOKpXx0//KTf3LXkEXxPs8='
WHERE
key_id = 'd95ebf92fc3606b20b862995f5c58fa652ff99559b7b0859c81879426285b9ea'
AND (
token = 'Do5nQTngt+Yk1hkM4kNqNCOKpXx0//KTf3LXkEXxPs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)