UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+WwfF1jIQV3CLSw+1bsCpP7qik9AiEzBw2K3KUc5ipw=' 
WHERE 
  key_id = '4b314999c9c993e010629b898040e6c61ec956c3c2f4fc8aaaf8646e1119d132' 
  AND (
    token = '+WwfF1jIQV3CLSw+1bsCpP7qik9AiEzBw2K3KUc5ipw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028