UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h6mi71HsbKeM52CPCDW9WlC7a4EEgE8DI0zZgIrfjZw=' 
WHERE 
  key_id = '9835726bfdafc822da9b68c6665177635c05827b3942089efbcc10bbe19c9437' 
  AND (
    token = 'h6mi71HsbKeM52CPCDW9WlC7a4EEgE8DI0zZgIrfjZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039