UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iDgSal491/p0Pyu79aO8efran78iaGRiBrbLjOlZL6o=' 
WHERE 
  key_id = 'cec5862559e9410ffb4d07f4c0c67f257ea8e223a40d98cb142f17d3d7b3fa95' 
  AND (
    token = 'iDgSal491/p0Pyu79aO8efran78iaGRiBrbLjOlZL6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038