UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qsBJ7HaMNXUl3rSjBsXH+lcmkQpxB9hkEPGVVlxsisQ='
WHERE
key_id = 'e797a4042ef8adabc91747ed9362b03f4021dd89e4a8bc34baceb49e114fd9f1'
AND (
token = 'qsBJ7HaMNXUl3rSjBsXH+lcmkQpxB9hkEPGVVlxsisQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)