UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/tZF1V+I6UX0dhCZkTL550IeNSyIxAWihKDF0lJ+2QY=' 
WHERE 
  key_id = '3991ca17c14b3a98249bf65197750f75351d101b5e826de8b2b93d4a4c84c70c' 
  AND (
    token = '/tZF1V+I6UX0dhCZkTL550IeNSyIxAWihKDF0lJ+2QY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040