UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R+U6eqA6YdEKZtWSzaEE5OU7ifhaU9c31ZfYOnV8Lfk='
WHERE
key_id = '2abed694152fce69e93d65a3625c1f91bc1caf9c9a82a4cdc7e988cd8a862a9b'
AND (
token = 'R+U6eqA6YdEKZtWSzaEE5OU7ifhaU9c31ZfYOnV8Lfk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)