UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TJBDohvYl2byr1W5E6TpE1F79W/rxb+8OODy2hRZvr8='
WHERE
key_id = 'c51bc80853ac416781c6d15eb11d1ece7cac353bd9eb4d248b4a3ab3a820a840'
AND (
token = 'TJBDohvYl2byr1W5E6TpE1F79W/rxb+8OODy2hRZvr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)