UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shGaWlI7VoejBcUCpacTilKdQ4B7h+mVQ+THCGExsR0=' 
WHERE 
  key_id = 'ce837cbd84e1461a183d63afb61735be2796bf68302626530d532344cdce2526' 
  AND (
    token = 'shGaWlI7VoejBcUCpacTilKdQ4B7h+mVQ+THCGExsR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025