UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g756OznTBFhQdah1F6h4PBhDTI7lumZrLZyeY04eloU=' 
WHERE 
  key_id = '5740a3d6029f13cde8ee34be151c6d1a9c3fe7750f8b5b5da84795bfafdd1d65' 
  AND (
    token = 'g756OznTBFhQdah1F6h4PBhDTI7lumZrLZyeY04eloU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046