UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dn550YnAG1Eh+3fNJlGIhXbMx035q428pzFquw6HlEg=' 
WHERE 
  key_id = '24764cad5434a166a1f602d500972fb1afce22e950cd29fa1eded34e117d00ac' 
  AND (
    token = 'Dn550YnAG1Eh+3fNJlGIhXbMx035q428pzFquw6HlEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022